<%@ include file="/WEB-INF/views/admin/header.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<div id="section">
	<div id ="mainContent">
			
			
			<div id="labelPage">ข้อมูล งวด</div>
			
			<!-- 
			<div id="ctrlWrap">
				<div id="ctrlL">
				</div>	
				<div id="ctrlR"><a href="periodAddForm"><img  src="${context}/resources/img/add.jpg"/></a></div>
			</div>
			 -->
			 
			 
			<form:form  action="${action}" method="post" id="periodEdit" modelAttribute="Period" >
				<table class="tableList">
				
				<tr class="tableHeader">
					<td>ชื่อ</td>
					<td colspan="3">รายละเอียด</td>
					<td>วันเริ่ม</td>
					<td>วันสิ้นสุด</td>
					
				</tr>
				<tr>
					<td><input type="text" name="name" value="${period.name}"></td>
					<td colspan="3"><input type="text" name="detail" value="${period.detail}"></td>
					<td><input type="text" name="startDt"  class="dateInput" value="${period.startDt}"></td>
					<td><input type="text" name="endDt"  class="dateInput"   value="${period.endDt}"></td>
				</tr>
				
				
				<tr class="tableHeader">
					<td>ออกสองตัวบน</td>
					<td>ออกสองตัวล้าง</td>
					<td>ออกสามตัวตรง</td>
					<td>ออกสามตัวโต้ด</td>
					<td>ออกสามตัวล่าง</td>
					<td>เงือนไข</td>
				</tr>
				
				<tr>
				<td><input type="text" name="winNumberTop" value="${period.winNumberTop}"></td>
					<td><input type="text" name="winNumberDown" value="${period.winNumberDown}"></td>
					<td><input type="text" name="win_ThreeNumberTang" value="${period.win_ThreeNumberTang}"></td>
					<td><input type="text" name="win_ThreeNumberTod" value="${period.win_ThreeNumberTod}"></td>
					<td><input type="text" name="win_ThreeNumberTangDown" value="${period.win_ThreeNumberTangDown}"></td>
					<td>
						<c:choose>
						      <c:when test="${action == 'periodEdit'}">
						      		${period.rule.name}<input type="hidden" name="ruleId" value="${period.rule.ruleId}">
						      </c:when>
						      <c:otherwise>
						      		<select name="ruleId" >
						      			<c:forEach var="rule" items="${rules}">
									        <option value="${rule.ruleId}">${rule.name}</option>
									    </c:forEach>
									</select>
						      </c:otherwise>
						</c:choose>
					</td>
				</tr>
				
				<tr>
				<td colspan="6"><input type="hidden" name="periodId" value="${period.periodId}"><button type="submit">บันทึก</button></td>
				</tr>
				
				</table>
			</form:form>
		
	</div>	
</div>
<%@ include file="/WEB-INF/views/admin/footer.jsp" %>



